window.onload = function() {
    document.getElementById('a').onmouseover = function() {
        document.getElementsByTagName('div')[0].style.backgroundImage = "url('images/banner.jpg')"
    }
    document.getElementById('b').onmouseover = function() {
        document.getElementsByTagName('div')[0].style.backgroundImage = "url('images/banner-3.jpg')"
    }
    var arr = ["url('images/banner.jpg')", "url('images/banner-3.jpg')"]
    var index = 0
    setInterval(function() {
        index++
        if (index > 2) {
            index = 0;
        }
        document.getElementById('lunbo').style.backgroundImage = arr[index]
    }, 3000)
}

var coumt = 3     //每页的个数 
        var datas = null
        function addspicture(e) {
            //确定分页
            var pagesize = Math.ceil(datas.length / coumt)
            var htmls = ""
            // console.log("e")
            for (var i = 0; i < datas.length; i++) {
                // console.log(pagesize)
                // console.log(i)
                htmls += `<li><div class="one">
                                <img class="picture1" src="${datas[i].image}" >        
                                <h2 class="picture2"> ${datas[i].h2} </h2>             
                                <p class="picture3">${datas[i].p}</p>
                              </div></li>`
            }
            document.getElementById("top").innerHTML = htmls
        }
        $(function () {
            $.getJSON("js/c2.json", function (e) {
                datas = e
                console.log(e)
                // addpicture()
                addspicture(0)
                // ma  
            })
        })
        function vedio2() {
            document.getElementById("v1").style.backgroundColor = "white";
            document.getElementById("v2").style.border = "30px solid white";
            document.getElementById("v2").style.borderLeftColor = "#987de6";
        }
        function vedio3() {
            document.getElementById("v1").style.backgroundColor = "#987de6";
            document.getElementById("v2").style.border = "30px solid #987de6";
            document.getElementById("v2").style.borderLeftColor = "white";

        }
// function vedio4(){

// }
$(document).ready(function() {
    $("#menu2 li a").wrapInner('<span class="out"></span>');
    $("#menu2 li a").each(function() {
        $('<span class="over">' + $(this).text() + '</span>').appendTo(this);
    });
    $("#menu2 li a").hover(function() {

        $(".out", this).stop().animate({
            'top': '48px'
        }, 300); // move down - hide

        $(".over", this).stop().animate({
            'top': '0px'
        }, 300); // move down - show
    }, function() {

        $(".out", this).stop().animate({
            'top': '0px'
        }, 300); // move up - show

        $(".over", this).stop().animate({
            'top': '-48px'
        }, 300); // move up - hide
    });
});
